package org.shangrila.app.sys.eo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the SYS_ROLES database table.
 * 
 */
@Entity
@Table(name="SYS_ROLES")
@NamedQuery(name="SysRole.findAll", query="SELECT s FROM SysRole s")
public class SysRole implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private long id;

	private String description;

	private String flag;

	private String name;

	//bi-directional many-to-many association to SysAuthority
	@ManyToMany
	@JoinTable(
		name="SYS_ROLE_AUTHORITY"
		, joinColumns={
			@JoinColumn(name="ROLEID")
			}
		, inverseJoinColumns={
			@JoinColumn(name="AUTHORITYID")
			}
		)
	private List<SysAuthority> sysAuthorities;

	//bi-directional many-to-many association to SysUser
	@ManyToMany(mappedBy="sysRoles")
	private List<SysUser> sysUsers;

	public SysRole() {
	}

	public SysRole(long id,String name) {
		this.id = id;
		this.name = name;
	}
	
	public long getId() {
		return this.id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getFlag() {
		return this.flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<SysAuthority> getSysAuthorities() {
		return this.sysAuthorities;
	}

	public void setSysAuthorities(List<SysAuthority> sysAuthorities) {
		this.sysAuthorities = sysAuthorities;
	}

	public List<SysUser> getSysUsers() {
		return this.sysUsers;
	}

	public void setSysUsers(List<SysUser> sysUsers) {
		this.sysUsers = sysUsers;
	}

}